<div class="write-post-container" [@flyIn]="'active'">
  <div class="row">
    <div class="col-sm-12">
      <form role="form" #form="ngForm" (ngSubmit)="form.form.valid && apply()" novalidate>
        <div class="form-group" [ngClass]="{ 'has-error': form.submitted && !title.valid }">
          <input type="text" required
                 #title="ngModel" [(ngModel)]="post.title" name="title" class="form-control" placeholder="标题，2到32个字符">
          <div *ngIf="form.submitted && !title.valid" class="text-danger">标题必须输入！</div>
        </div>
        <div class="form-group">
          <input type="text" [(ngModel)]="post.url" name="url" class="form-control"
                 placeholder="原文URL，如果是转载请粘贴，最长1024个字符，原创文章请保持空白">
        </div>
        <div class="form-group" [ngClass]="{ 'has-error': form.submitted && content.invalid }">
          <textarea id="post_editor" #content="ngModel" class="form-control" rows="20" name="content" [(ngModel)]="post.content"  required
                    placeholder="内容，最少140字，最多2万字。图片每张最大500K，每篇文章最多50张图。"></textarea>
          <div *ngIf="form.submitted && content.invalid" class="text-danger">文章内容必须输入！</div>
        </div>
        <button type="submit" class="btn btn-success">提交</button>
      </form>
    </div>
  </div>
</div>
